<!DOCTYPE html>  
<html>  
  <head>  
    <title>If ... Else</title>  
  </head>
  <body>  
    <script type="text/javascript">  
       if (20 > 18) {
         document.write("20 is greater than 18");document.write("<br>");
       }
       
       var x = 20;
       var y = 18;
       if (x > y) {
         document.write("x is greater than y");document.write("<hr>");
       }
       
       var time = 20;
       if (time < 18) {
         document.write("Good day.");document.write("<br>");
       } else {
         document.write("Good evening.");document.write("<hr>");
       }
       
       if (time < 10) {
         document.write("Good morning.");document.write("<br>");
       } else if (time < 25) {
         document.write("Good day.");document.write("<hr>");
       } else {
         document.write("Good evening.");document.write("<hr>");
       }
       
       var result = (time < 18) ? "Good day." : "Good evening.";
       document.write(result);
    </script> 
  </body>  
</html>